/**
 * @ Authors:
 * 
 * @Veronique De Laet
 * @Johan Willems
 * @Pierre Delaere
 * 
 * @version 2011
 */
package view;

import java.awt.Color;
import java.awt.Container;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.Iterator;
import java.util.TreeSet;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;

import controller.LectorLessenRoostercontroller;
import controller.OpstartController;
import controller.LessenroosterOverzichtController;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class CopyOfRoosterFrame extends JFrame  
{
	/**
	 * 
	 */
	//private static final long serialVersionUID = -4597071806855210301L;
	private RoosterFrame frame;
	
	private LectorLessenRoostercontroller lectorLessenrooster;
	private LessenroosterOverzichtController lessenrooster;
	private String x;
	private OpstartController opstartController;
	private JTable jTable1;
	private JScrollPane jScrollPane2;
	private JLabel jLabel1;

	public CopyOfRoosterFrame(OpstartController opstartController, RoosterFrame rooster, LessenroosterOverzichtController lessenrooster, String x){
	super("LessenRooster");
	this.frame = rooster;
	this.opstartController = opstartController;
	this.setLessenrooster(lessenrooster);
	Container container = getContentPane();
	container.setBackground(Color.YELLOW);
	container.setLayout(null);
	container.setPreferredSize(new java.awt.Dimension(493, 260));
	{
		  jScrollPane2 = new JScrollPane();
          container.add(jScrollPane2);
          jScrollPane2.setBounds(12, 37, 459, 202);
          {
			TableModel jTable1Model = 			
					new DefaultTableModel(
							lessenrooster.maakTable(lessenrooster.maakCursussenLijstStudent(x)),
							  lessenrooster.maakKolomNaam()); 
			jTable1 = new JTable();
			jScrollPane2.setViewportView(jTable1);
			jTable1.setModel(jTable1Model);
			jTable1.setBounds(117, 180, 215, 52);
          }
          {
          jLabel1 = new JLabel();
          container.add(jLabel1);
          jLabel1.setText("Uurrooster" + " " + x);
		  jLabel1.setBounds(12, 10, 171, 16);
	      }

	this.addWindowListener(new WindowAdapter()  
	{	          
			public void windowClosing(WindowEvent e){  
				setVisible(false);             
				try {
				toonMenu();
			} catch (Exception e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
			}	
	});
	
	
	setVisible(true);
	this.setSize(600, 600);
	}

}

	
	public CopyOfRoosterFrame(OpstartController opstartController, RoosterFrame rooster, LectorLessenRoostercontroller lectorLessenrooster, String x){
		super("LessenRooster");
		this.frame = rooster;
		this.opstartController = opstartController;
		this.setLectorLessenrooster(lectorLessenrooster);
		Container container = getContentPane();
		container.setBackground(Color.YELLOW);
		container.setLayout(null);
		container.setPreferredSize(new java.awt.Dimension(493, 260));
		{
			  jScrollPane2 = new JScrollPane();
	          container.add(jScrollPane2);
	          jScrollPane2.setBounds(12, 37, 459, 202);
	          {
				TableModel jTable1Model = 			
						new DefaultTableModel(
								lectorLessenrooster.maakTable(lectorLessenrooster.maakCursussenLijst(x)),
								lectorLessenrooster.maakKolomNaam()); 
				jTable1 = new JTable();
				jScrollPane2.setViewportView(jTable1);
				jTable1.setModel(jTable1Model);
				jTable1.setBounds(117, 180, 215, 52);
	          }
	          {
	          jLabel1 = new JLabel();
	          container.add(jLabel1);
	          jLabel1.setText("Uurrooster" + " " + x);
			  jLabel1.setBounds(12, 10, 171, 16);
		      }

		this.addWindowListener(new WindowAdapter()  
		{	          
				public void windowClosing(WindowEvent e){  
					setVisible(false);             
					try {
					toonMenu();
				} catch (Exception e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				}	
		});
		setVisible(true);
		this.setSize(600, 600);
		}

	}
	
	
	public LessenroosterOverzichtController getLessenrooster() {
	//public LessenroosterOverzichtController getLessenrooster() {
		return lessenrooster;
	}

	public void setLessenrooster(LessenroosterOverzichtController lessenrooster) {
	//public void setLessenrooster(LessenroosterOverzichtController lessenrooster) {
		this.lessenrooster = lessenrooster;
	}
	
	private void toonMenu() throws Exception{
		opstartController.execute();
	}

	
	public LectorLessenRoostercontroller getLectorLessenrooster() {
		return lectorLessenrooster;
	}

	public void setLectorLessenrooster(LectorLessenRoostercontroller lectorLessenrooster) {
		this.lectorLessenrooster = lectorLessenrooster;
	}
	
}
